package top.kaoshanji.p1ch08b;

/**
 * 代码清单-p1ch08b-70页a：具体工厂类
 * @author kaoshanji
 * ^_^
 * create time 2025/3/21 17:00
 */
public class ConcreteCreator extends Creator {

    @Override
    public <T extends Product> T createProduct(Class<T> c) {

        Product product = null;

        try {
            product = (Product)Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            // 异常处理
        }

        return (T) product;
    }
}
